<template>
  <div>
    订单详情

    <el-table
      :data="tableData"
      style="width: 100%"
      :row-class-name="tableRowClassName"
    >
      <el-table-column prop="orderNo" label="订单号" width="180"> </el-table-column>

      <el-table-column prop="orderTime" label="下单时间"></el-table-column>
      <el-table-column prop="phone" label="联系电话"> </el-table-column>
      <el-table-column prop="consignee" label="收货人"> </el-table-column>
      <el-table-column prop="deliverAddress" label="送货地址"> </el-table-column>
      <el-table-column prop="deliveryTime" label="送达时间"> </el-table-column>
      <el-table-column prop="remarks" label="备注"> </el-table-column>
      <el-table-column prop="orderAmount" label="订单金额"> </el-table-column>
      <el-table-column prop="orderState" label="订单状态"> </el-table-column>
      >
    </el-table>
  </div>
</template>

<script>
import { getOrderDetailReq } from "@/api/order";

export default {
  data() {
    return {
      id: "",
      //数据占位
      detail: {},
      fomdata: [],
      tableData: [{}],
    };
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex === 1) {
        return "warning-row";
      } else if (rowIndex === 3) {
        return "success-row";
      }
      return "";
    },
    async getData() {
      let res = await getOrderDetailReq({ id: this.id });
      //数据赋值
      let { data } = res.data;
      this.detail = data;
      this.tableData.push(data);
    },
  },
  created() {
    //获取query传参
    this.id = this.$route.query.id;
    this.getData();
  },
  filters:{
    clicex(){
      return 10000000
    }
  }
};
</script>

<style lang="scss" scoped>
.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}
</style>
